home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / wnos / wn941101 / iface.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-30  |  4.6 KB  |  140 lines

  1. #ifndef    _IFACE_H
  2. #define    _IFACE_H
  3.  
  4. #ifndef    _GLOBAL_H
  5. #include "global.h"
  6. #endif
  7.  
  8. #ifndef    _MBUF_H
  9. #include "mbuf.h"
  10. #endif
  11.  
  12. #ifndef _PROC_H
  13. #include "proc.h"
  14. #endif
  15.  
  16. struct flags {
  17.     int16 maxframe;
  18.     int16 t1init;
  19.     int16 t2init;
  20.     int16 t3init;
  21.     int16 t4init;
  22.     int16 t5init;
  23.     int16 t6init;
  24.     int16 retries;
  25.     int16 axwindow;
  26.     int16 paclen;
  27.     int16 pthresh;
  28.     int16 digipeat;
  29.     int t3disc;
  30.     int16 dama_slave;    /* flag for dama slave */
  31.     int dama_busy;        /* wait */
  32. };
  33.  
  34. /* Interface control structure */
  35. struct iface {
  36.     struct iface *next;        /* Linked list pointer */
  37.     char *name;            /* Ascii string with interface name */
  38.     int type;            /* Link header type for phdr */
  39.     struct iftype *iftype;        /* Pointer to appropriate iftype entry */
  40.     int32 addr;            /* IP address */
  41.     int32 broadcast;        /* Broadcast address */
  42.     int32 netmask;            /* Network mask */
  43.  
  44.     int (*ioctl) __ARGS((struct iface *, int, char **));
  45.                 /* From device -- when status changes */
  46.     int (*iostatus) __ARGS((struct iface *,int cmd,int32 val));
  47.                 /* Encapsulate an IP datagram */
  48.     int (*send) __ARGS((struct mbuf *,struct iface *,int32,int,int,int,int));
  49.                 /* Encapsulate any link packet */
  50.     int (*output) __ARGS((struct iface *,char *,char *,int16,struct mbuf *));
  51.                 /* Send raw packet */
  52.     int (*raw) __ARGS((struct iface *,struct mbuf *));
  53.                 /* Call before detaching */
  54.     int (*stop) __ARGS((struct iface *,int));
  55.                 /* Display status */
  56.     int (*status) __ARGS((struct iface *));
  57.  
  58.     int16 mtu;            /* Maximum transmission unit size */
  59.     int dev;            /* Subdevice number to pass to send */
  60.     int xdev;            /* Associated Slip or Nrs channel, if any */
  61.     int port;            /* KISS-subaddr for multiport */
  62.     int16 trace;            /* Trace flags */
  63. #define    IF_TRACE_OUT    0x01    /* Output packets */
  64. #define    IF_TRACE_IN    0x10    /* Packets to me except broadcast */
  65. #define    IF_TRACE_ASCII    0x100    /* Dump packets in ascii */
  66. #define    IF_TRACE_HEX    0x200    /* Dump packets in hex/ascii */
  67. #define    IF_TRACE_NOBC    0x1000    /* Suppress broadcasts */
  68. #define IF_TRACE_RAW    0x2000    /* Raw packet dump */
  69.     char *trfile;            /* Trace file name, if any */
  70.     FILE *trfp;            /* Stream to trace to */
  71.     char *hwaddr;            /* Device hardware address, if any */
  72.     struct iface *forw;        /* Forwarding interface for output, if rx only */
  73.     int32 ipsndcnt;            /* IP datagrams sent */
  74.     int32 rawsndcnt;        /* Raw packets sent */
  75.     int32 iprecvcnt;        /* IP datagrams received */
  76.     int32 rawrecvcnt;        /* Raw packets received */
  77.     int32 lastsent;            /* Clock time of last send */
  78.     int32 lastrecv;
  79.     struct proc *proc;        /* Pointer to line process, if any */
  80.     struct proc *proc1;        /* Second line process, if any */
  81.     struct proc *supv;
  82. #ifdef CRCSET
  83.         int sendcrc;
  84.         int32 crcerrors;
  85. #endif
  86.     void *extension;
  87.     int niface;            /* Iface number for routing tables */
  88.     struct lq *lq;            /* used by heard */
  89.     int Hmax;
  90. #define MAXDEFAULT    20        /* Initial heardtable value */
  91.     int Hcurrent;
  92.     struct flags *flags;        /* flags for AX25 use */
  93. };
  94. #define    NULLIF    (struct iface *)0
  95. extern struct iface *Ifaces;        /* Head of interface list */
  96. extern struct iface Loopback;        /* Optional loopback interface */
  97. extern struct iface Encap;
  98.  
  99. /* Header put on front of each packet in input queue */
  100. struct phdr {
  101.     struct iface *iface;
  102.     unsigned short type;        /* Use pktdrvr "class" values */
  103. };
  104.  
  105. extern char Noipaddr[];
  106. extern char Ifexist[];
  107. extern struct mbuf *Hopper;
  108. extern int Niface;
  109.  
  110. /* Interface encapsulation mode table entry. An array of these strctures
  111.  * are initialized in config.c with all of the information necessary
  112.  * to attach a device.
  113.  */
  114. struct iftype {
  115.     char *name;            /* Name of encapsulation technique */
  116.     int (*send) __ARGS((struct mbuf *,struct iface *,int32,int,int,int,int));
  117.                     /* Routine to send an IP datagram */
  118.     int (*output) __ARGS((struct iface *,char *,char *,int16,struct mbuf *));
  119.                     /* Routine to send link packet */
  120.     char *(*format) __ARGS((char *,char *));
  121.                     /* Function that formats addresses */
  122.     int (*scan) __ARGS((char *,char *));
  123.                     /* Reverse of format */
  124.     int type;            /* Type field for network process */
  125.     int hwalen;            /* Length of hardware address, if any */
  126. };
  127. #define    NULLIFT    (struct iftype *)0
  128. extern struct iftype Iftypes[];
  129.  
  130. /* In iface.c: */
  131. void init_flags __ARGS((struct iface *ifp));
  132. struct iface *if_lookup __ARGS((char *name));
  133. struct iface *ismyaddr __ARGS((int32 addr));
  134. int if_detach __ARGS((struct iface *ifp));
  135. int setencap __ARGS((struct iface *ifp,char *mode));
  136. char *if_name __ARGS((struct iface *ifp,char *comment));
  137. int bitbucket __ARGS((struct iface *ifp,struct mbuf *bp));
  138.  
  139. #endif    /* _IFACE_H */
  140.